//
//  HWOpenClothingCell.m
//  HWanGame
//
//  Created by 陈道斌 on 2019/9/9.
//  Copyright © 2019 Chendaobin. All rights reserved.
//

#import "HWOpenClothingCell.h"

@interface HWOpenClothingCell()
@property(strong,nonatomic) UILabel *datelabel;
@property(strong,nonatomic) UILabel *zhongjianLabel;
@property(strong,nonatomic) UIButton *kaifuButton;

@end

@implementation HWOpenClothingCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

        [self setupUI];
    
    }

    return  self;
    
    
}
// 设置UI
- (void)setupUI {
    
    self.datelabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 0,120, 30)];
    self.datelabel.text = @"09-09 15:30";
    self.datelabel.font = [UIFont systemFontOfSize:10];
    self.datelabel.textColor = RGB(51, 51, 51);
    [self.contentView addSubview:self.datelabel];
    
    
    self.zhongjianLabel = [[UILabel alloc]initWithFrame:CGRectMake(30, 0,120, 30)];
    self.zhongjianLabel.center = CGPointMake(kScreenW/2, 15);
    self.zhongjianLabel.textAlignment = NSTextAlignmentCenter;
    self.zhongjianLabel.text = @"仙尊11服";
    self.zhongjianLabel.font = [UIFont systemFontOfSize:12];
    self.zhongjianLabel.textColor = RGB(51, 51, 51);
    [self.contentView addSubview:self.zhongjianLabel];
    
    
    
    self.kaifuButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.kaifuButton.frame = CGRectMake(kScreenW-70-30, 2, 70, 25);
    [self.kaifuButton setTitle:@"已开服" forState:UIControlStateNormal];
    self.kaifuButton.layer.cornerRadius = 3;
    self.kaifuButton.layer.masksToBounds = YES;
    [self.kaifuButton setTitleColor:RGB(130, 130, 130) forState:UIControlStateNormal];
    self.kaifuButton.titleLabel.font = [UIFont systemFontOfSize:11];
    [self.kaifuButton setBackgroundColor:RGB(243, 243, 243)];
    [self.contentView addSubview:self.kaifuButton];
    
    
    
    
    
    
}


-(void)setDataDic:(NSDictionary *)dataDic {
    
    _dataDic = dataDic;
    self.datelabel.text = [NSString stringWithFormat:@"%@  %@",dataDic[@"time1"],dataDic[@"time2"]];
   // self.zhongjianLabel.text =  [NSString stringWithFormat:@"%@",dataDic[@"server_name"]];
    
    
     NSString *server_name =    [NSString stringWithFormat:@"%@",dataDic[@"server_name"]];
     NSString *str  = [server_name stringByReplacingOccurrencesOfString:@" " withString:@""];
     NSString *str1  = [str stringByReplacingOccurrencesOfString:@"\r" withString:@""];
     self.zhongjianLabel.text =  str1;    
    [self.kaifuButton setTitle:dataDic[@"type"] forState:UIControlStateNormal];
    
    
}

@end
